package com.ruoyi.project.museum.api;


import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.museum.exhibit.controller.ExhibitController;
import com.ruoyi.project.museum.exhibit.domain.Exhibit;
import com.ruoyi.project.museum.exhibit.service.IExhibitService;
import com.ruoyi.project.museum.exhibit.vo.ExhibitSimpleVO;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/api/museum/exhibit")
public class ExhibitApi extends BaseController {

    private static final Logger log = LoggerFactory.getLogger(ExhibitController.class);

    @Autowired
    private IExhibitService exhibitService;


    /**
     * 查询文物管理列表
     */
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(Exhibit exhibit)
    {
        startPage();
        List<Exhibit> list = exhibitService.selectExhibitList(exhibit);
        return getDataTable(list);
    }

    @PostMapping("/listByType")
    @ResponseBody
    public List<Exhibit> listByType(Integer typeId)
    {
        return exhibitService.selectExhibitByTypeId(typeId);
    }
    
    @PostMapping("/detail")
    @ResponseBody
    public Exhibit listById(Integer id)
    {
        return exhibitService.selectExhibitById(id);
    }
    
    @PostMapping("/previous")
    @ResponseBody
    public Exhibit previous(Exhibit exhibit)
    {
        return exhibitService.selectPervious(exhibit);
    }
    @PostMapping("/next")
    @ResponseBody
    public Exhibit next(Exhibit exhibit)
    {
        return exhibitService.selectNext(exhibit);
    }

    @PostMapping("/listIndex")
    @ResponseBody
    public List<Exhibit> listIndex() {
        return exhibitService.listIndex();
    }
    
    @PostMapping("/listSimple")
    @ResponseBody
    public List<ExhibitSimpleVO> listSimple() {
        return exhibitService.listSimple();
    }
}
